import Vue from 'vue';
import App from './App';
import store from './store/index';
import apiUrls from '@/common/api/url.js'
import language from '@/lang/index.js';
import { http } from '@/common/api/index.js';
import { message, Router } from '@/common/utils/index.js';
import { BASE_URL, IMG_BASE_URL, SYSTEM_CONFIG, PAGE_SIZE, VERSION_CODE, IS_DEV, needLoginPages } from '@/common/config.js';
import utils from '@/common/utils/utils';
import VueI18n from 'vue-i18n';

// 引入主包依赖
import VueCompositionAPI from "@vue/composition-api";


import './common/filter/index.js';
import './common/mixin/index.js';
const router = new Router({ needLoginPages });
// #ifdef APP-PLUS
import FuModal from '@/components/fu-modal/fu-modal.js';
Vue.use(FuModal); 
// #endif
Vue.use(VueCompositionAPI);
Vue.use(VueI18n);
Vue.config.productionTip = false;

const i18n = new VueI18n({
  locale: uni.getStorageSync('language') || 'zh',
  messages: {
    en: language.en, // 英文
    zh: language.zh, // 中文
  },
});

// console.log('apiUrls >>>>>>>',apiUrls);

Vue.prototype.$urouter = router;
Vue.prototype.$api = http;
Vue.prototype.$message = message;
Vue.prototype.$util = utils;
Vue.prototype.$store = store;
Vue.prototype._i18n = i18n;

global.apiUrls = apiUrls;
global.imgBaseUrl = IMG_BASE_URL;
global.IS_DEV = IS_DEV;
global.PAGE_SIZE = PAGE_SIZE;
global.VERSION_CODE = VERSION_CODE;
global.SYSTEM_CONFIG = SYSTEM_CONFIG;

App.mpType = 'app';

const app = new Vue({
  ...App,
  store,
  i18n,
});

app.$mount();

global.$showModal = app.$showModal;
